﻿using Entity.Finance.DTO.ExamineReimburse;
using Entity.Finance.View.ExamineReimburse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service;
using Service.Finance;
using Service.System;

namespace AnQinManagermentBackendAPI.Controller.Finance
{
    /// <summary>
    /// 报销审批
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    [AllowAnonymous]
    public class ExamineReimbursesController : ControllerBase
    {
        /**
         * 业务接口
         */
        private readonly ExamineReimburseService _service;

        /**
         * 构造函数注入
         */
        public ExamineReimbursesController(ExamineReimburseService service)
        {
            _service = service;
        }

        /// <summary>
        /// 获取列表
        /// </summary>
        [HttpGet]
        [ProducesResponseType(typeof(ExamineReimburseView), 200)]
        public async Task<IActionResult> GetExamineReimburseList([FromQuery] ExamineReimburseSearchDTO model)
        {
            var response = await _service.GetExamineReimburseList(model);
            return StatusCode(response.Status, response);
        }

        /// <summary>
        /// 审核通过
        /// </summary>
        [HttpPost("Pass")]
        public async Task<IActionResult> PassExamineReimburse([FromBody] string id)
        {
            var response = await _service.PassExamineReimburse(id);
            return StatusCode(response.Status, response);
        }

    }
}
